import request from '../utils/request'

// 获取用户频道列表数据的API

export const getUserChaneelsAPI = function () {
  return request.get('/v1_0/user/channels')
}

export const getArtListApi = (id, time) => {
  return request.get('/v1_0/articles', {
    params: {
      channel_id: id, // 频道的ID
      timestamp: time// 时间戳
    }
  })
}
// 将文章设为不敢兴趣的api
export const dislikeArticleAPI = id => {
  return request.post('/v1_0/article/dislikes', {
    target: id
  })
}

// 举报文章的api
// target是举报文章的ID type是文章举报的类型
export const reportArticleAPI = function (target, type) {
  return request.post('/v1_0/article/reports', { target, type })
}

export const allChannelsAPI = function () {
  return request.get('/v1_0/channels')
}

// 更新用户的频道列表数据
// channels是数组 数组中每一项的格式为{频道id,序号}
export const updateUserChannelAPI = function (channels) {
  return request.put('/v1_0/user/channels', { channels })
}
